var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');

var app = express();
var mongooess=require("mongoose");
app.listen(8004);
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));


app.use('/', indexRouter);
app.use('/users', usersRouter);



// mongooess.connect("mongodb://127.0.0.1:27017/pop");
// var db=mongooess.connection;
// db.on('error', console.error.bind(console, 'connection error:'));
// db.once('open', function() {
//
// });

//
// var UserSchame=mongooess.Schema({
//
//     name:String,
//     phone:String,
//     password:String,
//     headface:String,
//     created:Date
// });
//
// var saySchame=mongooess.Schema({
//
//     phone:String,
//     content:"",
//     created:Date
// });
//
// var Users=mongooess.model("users",UserSchame);
// var Says=mongooess.model("says",saySchame);



app.post("/api1",function (req,res) {

    res.json({name:"kkkkk",age:12,sex:"男",content:"ooooooooooo",type:"pos"});


});

app.get("/api2",function (req,res) {



    res.json({name:"kkkkk",age:12,sex:"男",content:"ooooooooooo",type:"get"});

});




module.exports = app;





